package com.yange.accountbook.popup

import android.content.Context
import android.widget.TextView
import com.lxj.xpopup.impl.PartShadowPopupView
import com.yange.accountbook.R


class BookAddTypePop(context: Context) : PartShadowPopupView(context) {

    lateinit  var tvAdd:TextView
    lateinit  var tvCode:TextView
    override fun getImplLayoutId() = R.layout.pop_add_book_type_layout

    private var itemClick: ItemClickListener?=null
    constructor(
        context: Context,
        itemClick: ItemClickListener
    ) : this(context) {
        this.itemClick = itemClick
    }

    override fun onCreate() {
        super.onCreate()
        tvAdd = findViewById(R.id.tv_add)
        tvCode = findViewById(R.id.tv_code)
        tvAdd.setOnClickListener {
            dismiss()
            itemClick?.itemClick(0)
        }
        tvCode.setOnClickListener {
            dismiss()
            itemClick?.itemClick(1)
        }
    }

    interface ItemClickListener{
        fun itemClick(index:Int)
    }

}